<template>
	<view class="w_list">
		<view class="baibox">
			<view class="baili">
				<view class="zhan">
					 微信<span>*</span>
					<view class="bnt">
						{{userInfo.wx_nickname?userInfo.wx_nickname:"未绑定"}}
					</view>
				</view>
				<view class="genghuan" @click="go_band()">
					{{userInfo.wx_nickname?"去更换":"去绑定"}}
				</view>
			</view>
			
			<view class="baili" @click="$go('/pages/user/withdrawal_set?type=2')">
				<view class="zhan">
					支付宝<span>*</span>
					<view class="bnt">
						{{userInfo.ali_username?userInfo.ali_username:"无"}}
					</view>
				</view>
				<image :src="'/images/rarr.png' | formatImgUrl" class="rarr" mode=""></image>
			</view>
			
			<view class="baili"  @click="$go('/pages/user/withdrawal_set?type=3')">
				<view class="zhan">
					银行卡<span>*</span>
					<view class="bnt">
						{{userInfo.card?userInfo.card:"无"}}
					</view>
				</view>
				<image :src="'/images/rarr.png' | formatImgUrl" class="rarr" mode=""></image>
			</view>
		</view>

	</view>
</template>
<script>
	export default {
		data() {
			return {
				userInfo: {}
			}
		},
		onLoad() {

		},

		onShow() {
			this.getUserInfo()
		},
		methods: {
			go_band(){
				
				// #ifndef APP
					uni.showToast({
						title: "请前往app绑定",
						icon: 'none',
					});
					return
				// #endif
		
				
				let _this = this;
				console.log("开始登陆--app")
				uni.login({
					"provider": "weixin",
					success: (loginRes) => {
						uni.getUserInfo({
							  provider: 'weixin',
							  success: function (infoRes) {
								  console.log(infoRes,7777777)
								  loginRes.authResult.nickname = infoRes.userInfo.nickName;
									_this.$api.default.request(
										'user/bangdTxNickname', {
											info: loginRes.authResult
										}).then((ret) => {
											console.log(ret,77777777)
											uni.showToast({
												title: "操作成功",
												icon: 'none',
											});
											_this.getUserInfo();
									})
							  }
						});
					}
				});
			},
			getUserInfo() {
				this.$api.default.request('user/userInfoTx', {}, 'POST', false).then((res) => {
					if (res.code) {
						this.userInfo = res.data
					}
				})
			}
			
		}
	}
</script>

<style lang="scss">
	page {
		background: rgba(242, 245, 242, 1);
	}

	.w_list {
		
		.baibox {
			background-color: #FFFFFF;
			padding: 0 28rpx;
			.baili:last-child {
				border-bottom: none;
			}

			.baili {
				display: flex;
				align-items: center;
				justify-content: space-between;
				height: 120rpx;
				border-bottom: 1px solid rgba(153, 153, 153, 0.1);
				
				.zhan {
					font-size: 28rpx;
					font-weight: bold;
					letter-spacing: 0em;
					color: #3D3D3D;
					.bnt{
						color: #999;
						font-size: 11px;
						font-weight: 500;
					}	
					span{
						color: red;
						margin-left: 7rpx
					};
				}
				.genghuan{
					font-size: 28rpx;
					font-weight: bold;
					color: #999;
				}

				.left {
					flex-shrink: 0;

					.title {
						font-size: 28rpx;
						font-weight: bold;
						letter-spacing: 0em;
						color: #3D3D3D;
						padding-bottom: 10rpx;
						.bnt{
							color: #999;
							font-size: 11px;
							font-weight: 500;
						}
					}

					.txt {
						font-size: 24rpx;
						font-weight: normal;
						letter-spacing: 0em;
						color: #3D3D3D;
					}
				}

				.centxt {
					font-size: 28rpx;
					font-weight: normal;
					text-align: right;
					letter-spacing: 0em;
					color: #999999;
					width: 440rpx;
				}

				.cenbox {
					flex-grow: 1;
					display: flex;
					align-items: center;
					justify-content: flex-end;
					padding: 0 16rpx;

					.headpic {
						width: 80rpx;
						height: 80rpx;
						border-radius: 50%;
					}

					.centxt {
						font-size: 28rpx;
						font-weight: normal;
						text-align: right;
						letter-spacing: 0em;
						color: #999999;
						width: 440rpx;
					}

					.qianbox {
						text-align: right;
						width: 450rpx;
						white-space: nowrap;

						.qli {
							background: rgba(153, 153, 153, 0.1);
							padding: 3rpx 12rpx 4rpx 8rpx;
							border-radius: 178px;
							font-size: 24rpx;
							color: #3D3D3D;
							display: inline-block;
						}

						.qli:not(:first-child) {
							margin-left: 16rpx;
						}
					}
				}

				.rarr {
					width: 40rpx;
					height: 40rpx;
					flex-shrink: 0;
				}
			}
		}

		.ti {
			width: 630rpx;
			height: 86rpx;
			border-radius: 8px;
			line-height: 86rpx;
			margin: 0 auto;
			opacity: 1;
			background: #45C4B0;
			font-size: 32rpx;
			font-weight: bold;
			text-align: center;
			letter-spacing: 0em;
			color: #FFFFFF;
		}

		
	}
</style>